#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
void testIota() {
  std::vector<int> l(10);
  std::iota(l.begin(), l.end(), 19);
  for (auto n : l) std::cout << n << "\n";
}

//
// std::all_of  都满足返回true
// std::itoa
// std::minmax_element
void testAllOf() {
  std::vector<int> v(10, 0);
  int i = 0;
  std::iota(v.begin(), v.end(), i++);
  if (std::all_of(v.cbegin(), v.cend(), [](int i) { return i % 2 == 0; })) {
    std::cout << "all numbers arr even\n";
  }

  auto it = std::find_if(v.begin(), v.end(), [](int n) { return n == 8; });
  if (it != v.end()) {
    std::cout << *it<< "\n";
  }

  std::partial_sort(v.begin(), v.begin() + 4, v.end(),
                    [](int i, int j) { return i > j; });

  for (auto& n : v) std::cout << n << "\n";

  auto res = std::minmax_element(v.begin(), v.end());
  std::cout << *(res.first) << *(res.second) << "\n";
}

// std::any_of
// std::none_of
// std::find_if_not
// std::copy_if

int main(int argc, char const* argv[]) {
  testAllOf();
  return 0;
}
